#ifndef QRESOURCEFILE_H
#define QRESOURCEFILE_H

#include "sharedlibglobal.h"

#include <QList>
#include <QStringList>

namespace SHAREDLIB
{
    class SHAREDLIB_EXPORT QResourceInfo
    {
    public:
        QResourceInfo();
        ~QResourceInfo();

        void          setResourceName(const QString &name);
        QString       resourceName();
        void          setResourceData(const QByteArray &data);
        QByteArray    resourceData();
    protected:
        QString     m_resourceName;
        QByteArray  m_resourceData;
    };

    class SHAREDLIB_EXPORT QResourceFile
    {
    public:
        ~QResourceFile();
        void    setFileName(const QString &name);
        QString fileName();
        bool    load(const QString &path);
        bool    save(const QString &path);
        void    clear();

        int     resourceCount();
        QResourceInfo* resource(int index);
        QResourceInfo* resource(const QString &resourceName);

        void    addResource(QResourceInfo *info);
        void    addResource(const QString &name,const QByteArray &data);
        void    removeResource(int index);
        void    removeResource(QResourceInfo *info);
        void    removeResource(const QString &name);

        QStringList resourceNames();

    protected:
        QList<QResourceInfo*>    m_resourceInfos;
        QString m_fileName;
    };

}

#endif // QRESOURCEFILE_H
